# encoding: utf-8
from urllib.parse import urlparse,urljoin
from flask import request

def is_safe_url(target):
    recv_url = urlparse(request.host_url)
    test_url = urlparse(urljoin(request.host_url,target))
    return test_url.scheme in ('http','https') and test_url.netloc == recv_url.netloc

